package com.zr.shortlink.project.controller;

import com.zr.shortlink.project.common.result.Result;
import com.zr.shortlink.project.common.result.Results;
import com.zr.shortlink.project.dto.req.ShortLinkCreateReqDTO;
import com.zr.shortlink.project.service.ShortLinkService;
import groovy.util.logging.Slf4j;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


/**
 * 短链接控制层
 */
@Slf4j
@Controller
@RequiredArgsConstructor
public class ShortLinkController {

    private final ShortLinkService shortLinkService;

    @PostMapping("api/short-link/v1/create")
    public Result createShortLink(@RequestBody ShortLinkCreateReqDTO requestparam) {
        shortLinkService.createShortLink(requestparam);
        return Results.success();
    }

}
